﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

/*
 *  author: able
 *  @2012/2/21 16:10:58
 * 
 */
namespace __ts.Core.Session
{
    /// <summary>
    /// 
    /// </summary>
    interface AttributeContainer
    {
        /**
         * Returns the value of the user-defined attribute for the given
         * <code>key</code>.
         * 
         * @param key
         *            the attribute's key, must not be <code>null</code>
         * @return <tt>null</tt> if there is no attribute with the specified key
         * @exception IllegalArgumentException
         *                if <code>key==null</code>
         * @see #setAttribute(AttributeKey, Object)
         */
        //<T> T getAttribute(AttributeKey<T> key);

        /**
         * Returns the value of the user-defined attribute for the given
         * <code>key</code>.
         * 
         * @param key
         *            the attribute's key, must not be <code>null</code>
         * @return <tt>null</tt> if there is no attribute with the specified key
         * @exception IllegalArgumentException
         *                if <code>key==null</code>
         * @see #setAttribute(AttributeKey, Object)
         */
        //<T> T getAttribute(AttributeKey<T> key, T value);

        /**
         * Removes the specified Attribute from this container. The old value will
         * be returned, <code>null</code> will be returned if there is no such
         * attribute in this container.<br>
         * <br>
         * This method is equivalent to <code>setAttribute(key,null)</code>.
         * 
         * @param key
         *            of the attribute to be removed,must not be <code>null</code>
         * @return the removed value, <code>null</code> if this container doesn't
         *         contain the specified attribute
         * @exception IllegalArgumentException
         *                if <code>key==null</code>
         */
        //<T> T removeAttribute(AttributeKey<T> key);

        /**
         * Sets a user-defined attribute. If the <code>value</code> is
         * <code>null</code> the attribute will be removed from this container.
         * 
         * @param key
         *            the attribute's key, must not be <code>null</code>
         * @param value
         *            the attribute's value, <code>null</code> to remove the
         *            attribute
         * @return The old attribute's value. <code>null</code> if there is no
         *         previous value or if the value is <code>null</code>
         * @exception IllegalArgumentException
         *                if {@code value!=null} and not an instance of type that is
         *                specified in the key (see {@link AttributeKey#getType()})
         * 
         * @see #getAttribute(AttributeKey)
         */
        //<T> T setAttribute(AttributeKey<? extends T> key, T value);

        /**
         * Returns an unmodifiable {@link Set} including all Keys of this container. If
         * this container contains no key's an empty {@link Set} will be returned.
         * 
         * @return all Keys, never <code>null</code>
         * @see Collections#unmodifiableSet(Set)
         */
        //Set<AttributeKey<?>> getAttributeKeys();
    }
}
